﻿<UserControl x:Class="MiniUML.View.Views.XmlView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:framework="clr-namespace:MiniUML.Framework;assembly=MiniUML.Framework"
             xmlns:utilities="clr-namespace:MiniUML.View.Utilities"
             xmlns:controls="clr-namespace:MiniUML.View.Controls">

    <StackPanel Background="{DynamicResource Style.Brushes.RibbonView.PanelBackground}">

        <Expander x:Name="_expander"
                  ExpandDirection="Down" IsExpanded="False"
                  Foreground="{DynamicResource Style.Brushes.RibbonView.Foreground}"
                  BorderThickness="0"
                  Expanded="expander_Expanded"
                  Collapsed="expander_Collapsed">

            <Expander.Header>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <TextBlock Text="XML Editor" VerticalAlignment="Center" Margin="2"/>
                    <Border MouseDown="updateDesignerButtonContainer_MouseDown">
                        <controls:CommandButton x:Name="_updateDesignerButton"
                                                Margin="15,2,2,0" Width="100" FontSize="9"
                                                Visibility="Hidden"
                                                Style="{DynamicResource GenericCommandButtonStyle}"
                                                CommandModel="{Binding cmd_UpdateDesigner}"
                                                CommandParameter="{Binding ElementName='_xmlTextBox', Path='Text'}"
                                                framework:CreateCommandBinding.Command="{Binding cmd_UpdateDesigner}"/>
                    </Border>
                </StackPanel>
            </Expander.Header>

            <StackPanel>
                <Thumb DragDelta="Thumb_DragDelta" Height="2" Cursor="SizeNS">
                    <Thumb.Template>
                        <ControlTemplate>
                            <Rectangle Fill="Transparent"/>
                        </ControlTemplate>
                    </Thumb.Template>
                </Thumb>
                <TextBox x:Name="_xmlTextBox"
                         Margin="2,0,2,2"
                         Height="220"
                         VerticalScrollBarVisibility="Auto"
                         HorizontalScrollBarVisibility="Auto"
                         TextWrapping="WrapWithOverflow"
                         AcceptsReturn="True"
                         PreviewKeyDown="xmlTextBox_PreviewKeyDown"/>
            </StackPanel>

        </Expander>

    </StackPanel>

</UserControl>
